/* #include "Stack.h"

//--------------构造空栈--------------
//栈其实就是个数组+指针（结构体）{确切的说是由栈底指针与栈底指针组成的结构体}
//构造栈就是新建（malloc）数组然后将栈底指针与栈顶指针指向数组，
//malloc函数申请内存失败会返回NULL，而申请成功后的返回类型为未定义void，
//需要自己强制转化类型！
Status initStack(SqStack *s)   //输入参数：结构体指针
{
    //s->base = new SElemType[MAXSIZE];       //C++版
    s->base = (SElemType *)malloc(sizeof(SElemType)*MAXSIZE);    //C语言版
    if (s->base == NULL)
    {
        //exit(OVERFLOW);//分配失败 C++版
        exit(1);  // 判断是否分配成功
    }
    s->top = s->base;
    s->stacksize = MAXSIZE;
    return OK;
}

//---------------入栈------------------
Status push(SqStack *s, SElemType e)  //输入参数S：栈的指针结构体，e：入栈元素
{
     //判断栈满
    if (s->top - s->base == s->stacksize)
    {
        return ERROR;
    }
    //存入元素,*为取指针的值
    s->top++;
    *s->top = e;   //top就是malloc申请的数组的数组指针，
    return OK;
}

//-----------出栈,用e返回栈顶值-----------------
SElemType pop(SqStack *s) 
{
    SElemType e;
    //判断栈为空
    if (s->top == s->base)
    {
        //若为空则返回一个（-1，-1）的点，判断由外部调用时进行
        e.x = -1;
        e.y = -1;
        return e;
    }
    e = *s->top;
    s->top--;
    return e;
}

Status clearStack(SqStack *s) 
{
    s->top = s->base;
    return OK;
}

void destroyStack(SqStack *s) 
{
    s->top = NULL;
    s->stacksize = 0;
    free(s->base);
}
 
Status stackTravel(SqStack *s) 
{
    while (s->top != s->base)
    {
        s->base++;
        Pos p = *s->base;
        //输出走过的路径
        cout <<"("<<p.x<<","<<p.y<<")"<< "-->";
        if ( p.x == 0 || p.y == 0|| p.x == 9 ||p.y == 9)
        {
            //终点输出为“End”
            cout << "End";
        }
    }
    cout << endl;
    return 0;
} */